<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MasterForm
 *
 * @author Sorasak Siangsanan
 */
class MasterForm extends CFormModel {

    public function confirm($orderId) {
        $order = Order::model()->findByPk($orderId);
        
        if (!isset($order)) {
            $this->addError('throw_error', Yii::t('master', 'order_not_found'));
            return false;
        }

        $order->status_id = 5;

        if ($order->update()) {
            return true;
        }

        $this->addError('throw_error', Yii::t('master', 'order_update_fail'));
        return false;
    }

}
